<template>
  <div class="page-card article-page">
    <h-query @search="search">

    </h-query>
    <h-table
      ref="htable"
      @init="getList"
      :config="config"
      :showHeadBgNone="false"
      :zebraStripes="false">
      <span slot="status" slot-scope="{text, record}">
        <a-tag color="blue">{{ record.statusText }}</a-tag>
      </span>
      <span slot="action" slot-scope="{text, record}">
        <a class="red" @click="remove(record)">删 除</a>
      </span>
    </h-table>

  </div>
</template>
<script>
import { semHistory } from '@/api/serve';
export default {
  data() {
    return {
      config: {
        rowKey: 'id',
        bordered: true,
        dataSource: [],
        columns: [
          {
            align: 'center',
            title: '序号',
            dataIndex: 'index',
            scopedSlots: { customRender: 'index' }
          },
          {
            align: 'center',
            title: '网上反应内容',
            dataIndex: 'title',
            width: 400
          },
          {
            align: 'center',
            title: '信息来源',
            dataIndex: 'source'
          },
          {
            align: 'center',
            title: '办理情况',
            dataIndex: 'status',
            scopedSlots: { customRender: 'status' }
          },
          {
            align: 'center',
            title: '反馈结果',
            dataIndex: 'result'
          },
          {
            align: 'center',
            title: '单位',
            dataIndex: 'unit'
          },
          {
            align: 'center',
            title: '时间',
            dataIndex: 'time'
          },
          {
            align: 'center',
            title: '操作',
            dataIndex: 'action',
            scopedSlots: { customRender: 'action' }
          }
        ],
        pagination: {
          total: 100
        }
      },
      form: {

      },
      selectedRowKeys: [],
      selectedRow: [],
      show: false
    };
  },
  methods: {
    getList(params) {
      semHistory().then(res => {
        this.config.dataSource = res.data.list;
      });
    },
    changeStatus({ id, status }) {
      this.$message.success(status ? '发布成功' : '下线成功');
    },
    remove(record) {
      this.$message.success('删除成功');
      this.$refs.htable.refresh(true);
    },
    search(query) {
      console.log(query);
      this.$refs.htable.refresh();
    }
  }
};
</script>
<style lang="less" scoped>
.article-page {
  // .a-button-blue {
  //   position: absolute;
  //   right: 0;
  //   top: 0;
  // }
}
</style>
